package hello;

import java.io.UnsupportedEncodingException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HomeController
{
	@Autowired
	private HttpServletRequest request;

	@Autowired
	private HttpServletResponse response;

	@RequestMapping(value = "Home/test", produces = "text/html;charset=gbk")
	public @ResponseBody String test()
	{

		StringBuilder sb = new StringBuilder();
		sb.append("url123:中<br>");
		// sb.append(request.getRequestURI());
		sb.append(request.getRequestURL());
		return sb.toString();
	}

	@RequestMapping(value =
	{ "/multi1", "/multi2", "Home/multiUrl" })
	public @ResponseBody String multiUrl()
	{
		return "home multiurl  23";
	}

	@RequestMapping("Home/Index")
	public @ResponseBody String Index()
	{
		return "Home/Index action";

	}

	// http://www.cnblogs.com/xing901022/p/5263702.html
	// http://www.jianshu.com/p/eaaba8dc3ab3

}
